<template>
  <div class="app-container">
    <el-card class="mar_bottom">
      <el-search-form label-width="90px" @search="onSearch" @reset="onReset">
        <el-form-item>
          <el-select
            size="small"
            style="width: 100px; margin-right: -2px"
            v-model="timeType"
            placeholder="请选择"
          >
            <el-option label="创建时间" value="createDate"></el-option>
            <el-option label="订单时间" value="orderTime"></el-option>
          </el-select>
          <el-date-picker
            size="small"
            v-model="searchBody.timeRange"
            style="width: 350px"
            type="datetimerange"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            value-format="yyyy-MM-dd HH:mm:ss"
            :default-time="['00:00:00', '23:59:59']"
          ></el-date-picker>
        </el-form-item>

        <el-form-item label="ID">
          <el-input
            clearable
            size="small"
            v-model="searchBody.id"
            class="el-input__small"
          ></el-input>
        </el-form-item>
        <el-form-item label="账号">
          <el-input
            clearable
            size="small"
            v-model="searchBody.phone"
            class="el-input__small"
          ></el-input>
        </el-form-item>
        <el-form-item label="上级账号">
          <el-input
            clearable
            size="small"
            v-model="searchBody.pPhone"
            class="el-input__small"
          ></el-input>
        </el-form-item>
        <el-form-item label="邀请码">
          <el-input
            clearable
            size="small"
            v-model="searchBody.yaoqingma"
            class="el-input__small"
          ></el-input>
        </el-form-item>

      </el-search-form>
    </el-card>

    <el-card>
      <el-tabs
        style="margin-top: 15px"
        v-model="searchBody.levelId"
        @tab-click="getData"
      >
        <el-tab-pane label="全部" name="0"></el-tab-pane>
        <el-tab-pane label="高级合伙人" name="6"></el-tab-pane>
        <el-tab-pane label="中级合伙人" name="5"></el-tab-pane>
        <el-tab-pane label="初级合伙人" name="4"></el-tab-pane>
        <el-tab-pane label="钻石" name="3"></el-tab-pane>
        <el-tab-pane label="白金" name="2"></el-tab-pane>
        <el-tab-pane label="黄金" name="1"></el-tab-pane>

      </el-tabs>

      <el-pagination
        small
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="pageNo"
        :page-sizes="pageSizeOpts"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="totalCount"
      >
      </el-pagination>
      <div class="have-pagination-container">
        <el-table v-loading="loading.list" :data="list">
          <el-table-column
            v-if="tableColumn[0].checked"
            label="ID"
            prop="id"
            align="center"
            width="50"
          ></el-table-column>
          <el-table-column
            v-if="tableColumn[1].checked"
            label="创建时间"
            prop="createDate"
            align="center"
            width="160"
          ></el-table-column>
          <el-table-column
            v-if="tableColumn[2].checked"
            label="手机号"
            prop="phone"
            align="center"
            width="160"
          ></el-table-column>
          <el-table-column
            v-if="tableColumn[3].checked"
            label="邀请码"
            prop="yaoqingma"
            align="center"
            width="160"
          ></el-table-column>
          <el-table-column
            v-if="tableColumn[4].checked"
            label="余额"
            prop="balance"
            align="center"
            width="160"
          ></el-table-column>
          <el-table-column
            v-if="tableColumn[5].checked"
            label="等级"
            prop="levelValue"
            align="center"
            width="360"
          ></el-table-column>
          <el-table-column
            v-if="tableColumn[6].checked"
            label="可提现金额"
            prop="canTixian"
            align="center"
            width="160"
          ></el-table-column>
          <el-table-column
            v-if="tableColumn[7].checked"
            label="直推人"
            prop="zhituirenPhone"
            align="center"
            width="160"
          ></el-table-column>
          <el-table-column
            v-if="tableColumn[8].checked"
            label="直推人ID"
            prop="pid"
            align="center"
            width="50"
          ></el-table-column>
          <el-table-column
            v-if="tableColumn[9].checked"
            label="二维码"
            prop="qrCode"
            align="center"
            width="160"
          >
            <template slot-scope="scope">
              <el-image style="width: 30px; height: 30px" :src="scope.row.qrCode" :preview-src-list="[scope.row.qrCode]">
                <div slot="error" class="image-slot">
                  <i class="el-icon-picture-outline"></i>
                </div>
              </el-image>
            </template>
          </el-table-column>

          <el-table-column
            align="center"
            fixed="right"
            label="操作"
            width="100"
          >
            <template slot-scope="scope">
              <el-button
                type="text"
                size="small"
                @click="handleClick('updateQrcode', scope.row)"
              >二维码</el-button>
              <el-button
                type="text"
                size="small"
                @click="handleClick('setLevel', scope.row)"
              >等级</el-button>
              <el-button
                type="text"
                size="small"
                @click="handleClick('setYaoqingma', scope.row)"
              >邀请码</el-button>
              <el-button
                type="text"
                size="small"
                @click="handleClick('setLevel', scope.row)"
              >提现</el-button>
              <el-button
                type="text"
                size="small"
                @click="handleClick('selectShouyi', scope.row)">收益</el-button
              >
              <el-button
                type="text"
                size="small"
                @click="handleClick('xian', scope.row)">线</el-button
              >
              <el-button
                :type="scope.row.status === '1' ? 'danger' : 'warning'"
                size="small"
                @click="handleClick('dongjie', scope.row)">  {{scope.row.status === '1' ? '冻结' : '解冻'}}</el-button
              >
            </template>
          </el-table-column>
        </el-table>
      </div>
      <el-pagination
        small
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="pageNo"
        :page-sizes="pageSizeOpts"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="totalCount"
      >
      </el-pagination>
    </el-card>
    <!-- 设置等级弹窗 -->
    <el-dialog
      title="设置等级"
      :visible.sync="configDialog"
      width="50%"
      :close-on-click-modal="false"
    >

          <el-form
            label-width="100px"
            ref="updateForm2"
            inline
            :model="updateForm"
          >
            <el-form-item label="等级" prop="levelId">
              <el-select
                class="el-input__medium"
                v-model="updateForm.levelId"
                placeholder="请选择"
                id="levelId"
              >
                <el-option label="无" value="0"></el-option>
                <el-option label="黄金" value="1"></el-option>
                <el-option label="白金" value="2"></el-option>
                <el-option label="钻石" value="3"></el-option>
                <el-option label="初级合伙人" value="4"></el-option>
                <el-option label="中级合伙人" value="5"></el-option>
                <el-option label="高级合伙人" value="6"></el-option>
              </el-select>
            </el-form-item>
          </el-form>



      <span slot="footer" class="dialog-footer">
        <el-button type="primary" plain @click="configDialog = false"
        >取 消</el-button
        >
        <el-button type="primary" @click="handleSure('updateSetLevel')"
        >确 定</el-button
        >
      </span>
    </el-dialog>

    <!-- 设置邀请码弹窗 -->
    <el-dialog
      title="设置邀请码"
      :visible.sync="yaoqingmaDialog"
      width="50%"
      :close-on-click-modal="false"
    >

      <el-form
        label-width="100px"
        ref="updateForm2"
        inline
        :model="updateForm"
      >
        <el-form-item label="邀请码" prop="yaoqingma">
          <el-input
            clearable
            size="small"
            v-model="updateForm.yaoqingma"
            class="el-input__small"
            id="yaoqingma"
          ></el-input>
        </el-form-item>
      </el-form>



      <span slot="footer" class="dialog-footer">
        <el-button type="primary" plain @click="yaoqingmaDialog = false"
        >取 消</el-button
        >
        <el-button type="primary" @click="handleSure('updateSetYqm')"
        >确 定</el-button
        >
      </span>
    </el-dialog>

    <!-- 收益明细弹窗 -->
    <el-dialog
      title="收益明细"
      :visible.sync="shouyiDialog"
      width="90%"
      :close-on-click-modal="false"
    >

      <!-- 二级节点value列表 -->
      <div class="have-pagination-container">
        <el-table border v-loading="loading.childList" :data="childList"  :row-class-name="shouyiTableRowClassName" >
          <el-table-column prop="orderId" label="订单ID"></el-table-column>
          <el-table-column prop="canTixian" label="可提现"></el-table-column>
          <el-table-column prop="shouyi" label="收益"></el-table-column>
          <el-table-column prop="levelValue" label="等级"></el-table-column>
          <el-table-column prop="shouyiType" label="收益类型"></el-table-column>
          <el-table-column prop="getShouyiDate" label="收益时间"></el-table-column>
          <!--          <el-table-column label="操作">
                      <template slot-scope="scope">
                        <el-button
                          type="text"
                          size="small"
                          @click="handleClick('updateChild', scope.row)"
                        >修改</el-button
                        >
                        <el-button
                          type="text"
                          size="small"
                          @click="handleClick('removeChild', scope.row)"
                        >删除</el-button
                        >
                      </template>
                    </el-table-column>-->
        </el-table>
      </div>
      <div class="pagination-box">
        <el-pagination
          @current-change="handleCurrentChangeChild('childList', $event)"
          @size-change="handleSizeChangeChild('childList', $event)"
          :current-page.sync="childPageNo"
          :page-size="childPageSize"
          :page-sizes="pageSizeOpts"
          layout="total, sizes, prev, pager, next"
          :total="childTotalCount"
        >
        </el-pagination>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" plain @click="shouyiDialog = false"
        >关 闭</el-button
        >
        <!--        <el-button type="primary" @click="handleSure('updateValue')"
                >确 定</el-button
                >-->
      </span>
    </el-dialog>

    <!-- 账号冻结弹窗 -->
    <el-dialog
      :title="dongjieDialogTitle"
      :visible.sync="dongjieDialog"
      width="70%"
      :close-on-click-modal="false"
    >

      <!-- 二级节点value列表 -->
      <div class="have-pagination-container">
        <el-table border v-loading="loading.userOrderList" :data="userOrderList"   >
          <el-table-column prop="id" label="线索ID"></el-table-column>
          <el-table-column prop="createDate" label="创建时间"></el-table-column>
          <el-table-column prop="shouyi" label="业主"></el-table-column>
          <el-table-column prop="levelValue" label="手机"></el-table-column>
          <el-table-column prop="shouyiType" label="城市"></el-table-column>
          <el-table-column prop="getShouyiDate" label="地址"></el-table-column>
          <el-table-column prop="getShouyiDate" label="订单价格"></el-table-column>
          <el-table-column prop="isLiangfang" label="isLiangfang">
            <template slot-scope="scope">
              <el-tag
                :type="scope.row.isLiangfang === '1' ? 'success' : 'danger'"
                disable-transitions>{{scope.row.isLiangfangValue}}</el-tag>
            </template>
          </el-table-column>
          <!--          <el-table-column label="操作">
                      <template slot-scope="scope">
                        <el-button
                          type="text"
                          size="small"
                          @click="handleClick('updateChild', scope.row)"
                        >修改</el-button
                        >
                        <el-button
                          type="text"
                          size="small"
                          @click="handleClick('removeChild', scope.row)"
                        >删除</el-button
                        >
                      </template>
                    </el-table-column>-->
        </el-table>
      </div>
      <div class="pagination-box">
        <el-pagination
          @current-change="handleCurrentChangeChild('userOrderList', $event)"
          @size-change="handleSizeChangeChild('userOrderList', $event)"
          :current-page.sync="childUserOrderPageNo"
          :page-size="childUserOrderPageSize"
          :page-sizes="pageSizeOpts"
          layout="total, sizes, prev, pager, next"
          :total="childUserOrderTotalCount"
        >
        </el-pagination>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" plain @click="dongjieDialog = false"
        >关 闭</el-button
        >
        <el-button type="primary" @click="handleSure('dongjie')"
        >确 定</el-button
        >
      </span>
    </el-dialog>


    <!-- 线明细弹窗 -->
    <el-dialog
      :title="xianDialogTitle"
      :visible.sync="xianDialog"
      width="70%"
      fullscreen="true"
      :close-on-click-modal="false"
    >
      <div class="block">
        <el-timeline>
          <el-timeline-item
            v-for="(activity, index) in activities"
            :key="index"
            :icon="activity.icon"
            :type="activity.type"
            :color="activity.color"
            :size="activity.size"
            :timestamp="activity.timestamp">
            {{activity.content}}
          </el-timeline-item>
        </el-timeline>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" plain @click="xianDialog = false"
        >关 闭</el-button>
      </span>
    </el-dialog>

  </div>
</template>

<script>
import {
  paidanOrder,
  selectPaidanPageVo,
  selectRegionTree,
  sysDictbyMultiType,
  addNewOrder,
  editXiansuo,
  exportInData,
  exportOutData,
  selectRegisterListPage,
  jiazhuangdingdanshenhe,
  updateUserLevel, selectShouyiPageByOrder, selectShouYiPageByUser,
  userSetYaoqingma,
  qrCode, dongjieUser,selectSysUserXianVoList
} from "@/api/api.js";
import {sysDict_delete} from "@/api/dataDict";

const getDefaultForm = () => ({
  levelId:null,
  userId:null,
  yaoqingma:null
});
const getDefaultSearchBody = () => ({
  timeRange: null,
  resource: null,
  phone: null,
  yezhu: null,
  orderNo: null,
  userIdList: null,
  id: null,
  audiStatus: "0",
  levelId:null,
  yaoqingma:null,
});
export default {
  data() {
    return {
      xianDialogTitle:"线",
      xianDialog:false,
      activities: [

      ],
      orderRiZhi: [],
      areaOptions: [],
      qdzOptions: [],
      resourceOptions: [],
      fw1Options: [],
      fw2Options: [],
      zxfs1Options: [],
      zxfs2Options: [],
      zxfs3Options: [],
      zxfs4Options: [],
      xhfgOptions: [],
      zxysOptions: [],
      jsStatusOptions: [],
      timeType: "createDate",
      searchType: "phone",
      dialogTitle: "",
      dialogTitle2: "",
      dialogTitle3: "",
      handleType: "",
      pageNo: 1,
      pageSize: 20,
      totalCount: 0,
      childPageNo: 1,
      childPageSize: 20,
      childTotalCount: 0,
      childUserOrderPageNo: 1,
      childUserOrderPageSize: 20,
      childUserOrderTotalCount: 0,
      pageSizeOpts: [20, 50, 100, 300, 500],
      loading: {
        list: false,
        list2: false,
        childList: false,
        userOrderList:false,
      },
      list: [],
      paidanData: {},
      selectRow: [], // 选中行
      lookDialog: false,
      editDialog: false,
      paidanDialog: false,
      updateForm: getDefaultForm(),
      searchBody: getDefaultSearchBody(),
      configDialog:false,
      yaoqingmaDialog:false,
      tableColumn: [
        {
          label: "线索ID",
          checked: true,
        },
        {
          label: "线索业主",
          checked: true,
        },
        {
          label: "线索手机",
          checked: true,
        },
        {
          label: "线索城市",
          checked: true,
        },
        {
          label: "派单",
          checked: true,
        },
        {
          label: "接单",
          checked: true,
        },
        {
          label: "订单",
          checked: true,
        },
        {
          label: "结算",
          checked: true,
        },
        {
          label: "标记",
          checked: true,
        },
        {
          label: "更新小计",
          checked: true,
        },
        {
          label: "来源",
          checked: true,
        }
       /* {
          label: "管理员/渠道主/达人",
          checked: true,
        },*/
        /*{
          label: "手机归属",
          checked: true,
        },
        {
          label: "线索时间",
          checked: true,
        },
        {
          label: "需求时间（订单）",
          checked: true,
        },
        {
          label: "更新时间",
          checked: true,
        },
        {
          label: "更新人",
          checked: true,
        },*/
      ],
      tableColumn2: [
        {
          label: "线索ID",
          checked: true,
        },
        {
          label: "订单GUID",
          checked: false,
        },
        {
          label: "线索UUID",
          checked: true,
        },
        {
          label: "线索姓名",
          checked: true,
        },
        {
          label: "线索城市",
          checked: true,
        },
        {
          label: "线索时间",
          checked: true,
        },
        {
          label: "渠道主",
          checked: true,
        },
        {
          label: "达人",
          checked: true,
        },
        {
          label: "派单时间",
          checked: true,
        },
        {
          label: "接单时间",
          checked: true,
        },
        {
          label: "产生需求",
          checked: true,
        },
        {
          label: "需求时间(订单)",
          checked: true,
        },
        {
          label: "需求城市",
          checked: true,
        },
        {
          label: "渠道主奖励",
          checked: true,
        },
        {
          label: "达人奖励",
          checked: true,
        },
        {
          label: "结算状态",
          checked: true,
        },
        {
          label: "结算时间",
          checked: true,
        },
      ],
      shouyiUserId: 0,
      shouyiDialog: false,
      dongjieDialog: false,
      dongjieDialogTitle: "账号冻结",
    };
  },
  created() {
    this.getData();

  },
  methods: {

    onSearchTypeChange(key) {
      let val;
      for (let key2 of ["yezhu", "phone", "orderNo", "id"]) {
        val = this.searchBody[key2] || val;
      }
      this.searchBody = Object.assign(this.searchBody, {
        [key]: val,
      });
    },
    getData() {
      this.loading.list = true;
      const { timeRange, userIdList, ...rest } = this.searchBody;
      const [startTime, endTime] = timeRange || [null, null];
      /*const _userIdList = (userIdList || []).reduce((a, b) => {
        return Array.from(new Set(a.concat(b)));
      }, []);*/
      selectRegisterListPage({
        pageNo: this.pageNo,
        pageSize: this.pageSize,
        startTime: startTime,
        endTime: endTime,

        ...rest,
      }).then(({ result }) => {
        this.list = result.data;
        this.totalCount = result.totalCount;
        this.loading.list = false;
      });
    },
    handleCurrentChangeChild(type, val) {
      switch (type) {
        case "list":
          this.pageNo = val;
          this.getData();
          break;
        case "childList":
          this.childPageNo = val;
          this.getShouyiData();
          break;
      }
    },
    handleSizeChangeChild(type, val) {
      switch (type) {
        case "list":
          this.pageSize = val;
          this.getData();
          break;
        case "childList":
          this.childPageSize = val;
          this.getShouyiData();
          break;
      }
    },
    getData2() {},
    handleSizeChange(val) {
      this.pageSize = val;
      this.getData();
    },
    shouyiTableRowClassName({row, rowIndex}){
      if (row.levelValue === '黄金') {
        return 'huangjing-row';
      }
      return '';

    },
    handleCurrentChange(val) {
      this.pageNo = val;
      this.getData();
    },
    handleSelectionChange(val) {
      this.selectIds = val.map((d) => d.id);
    },
    onSearch() {
      this.pageNo = 1;
      this.getData();
    },
    onReset() {
      this.pageNo = 1;
      this.searchBody = getDefaultSearchBody();
      this.getData();
    },
    getShouyiData() {
      this.loading.childList = true;
      selectShouYiPageByUser({
        pageNo: this.childPageNo,
        pageSize: this.childPageSize,
        userId: this.shouyiUserId,
      })
        .then(({ result = {} }) => {
          this.childList = result.data;
          this.childTotalCount = result.totalCount;
          this.loading.childList = false;
        })
        .catch(() => {
          this.loading.childList = false;
        });
    },
    handleClick(type, row, title) {
      this.handleType = type;
      switch (type) {
        case "xian":
          this.xianDialog = true;
          this.xianDialogTitle = "账号  :  "+row.phone;
          selectSysUserXianVoList(
            {
              id:row.id,
            }
          ).then((res) => {
            this.activities = res.result;
          });
          break;
        case "dongjie":
          var rowStatus = row.status;
          if(rowStatus === '1'){
            // 当前状态是正常状态 冻结
            this.$confirm(`确认冻结该账号 ？ `+row.phone, "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning",
            }).then(() => {
              dongjieUser(
                {
                  id:row.id,
                }
              ).then((res) => {
                this.$message.success(res.msg || "操作成功");
                this.getData();
              });
            });
          }else if(rowStatus === '2'){
            // 当前状态是正常状态 解冻
            this.$confirm(`确认解冻该账号 ？ `+row.phone, "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning",
            }).then(() => {
              dongjieUser(
                {
                  id:row.id,
                }
              ).then((res) => {
                this.$message.success(res.msg || "操作成功");
                this.getData();
              });
            });
          }

          break;
        case "selectTuanduiVo":
          break;
        case "updateQrcode":
          this.$confirm(`确认生成新二维码？`, "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          }).then(() => {
            qrCode({
              id: row.id,
            }).then((res) => {
              this.$message.success(res.msg || "操作成功");
              this.getData();
            });
          });
          break;
        case "setYaoqingma":
          this.dialogTitle = "用户:" + row.phone;
          this.yaoqingmaDialog = true;
          this.updateForm.userId = row.id;
          break;
        case "setLevel":
          this.dialogTitle = "订单ID:" + row.id + "-" + title;
          this.configDialog = true;
          this.updateForm.userId = row.id;
          break;
        case "updateSetLevel":
          console.log("123");
          break;
        case "add":
          this.dialogTitle2 = "营销-添加";
          this.editDialog = true;
          this.updateForm = getDefaultForm();
          break;
        case "update":
          this.dialogTitle2 = "营销ID:" + row.id + "-编辑";
          selectXiansuoInfoVo({
            id: row.id,
          }).then((res) => {
            const { provinceCode, cityCode, areaCode, ...rest } = res.result;
            this.updateForm = Object.assign(rest, {
              addrCode: [provinceCode, cityCode, areaCode],
            });
            this.editDialog = true;
          });
          break;
        case "fenpai":
          break;
        case "exportOut":
          exportOutData().then((res) => {
            this.$message.success("导出成功");
          });
          break;
        case "paidan":
          this.dialogTitle3 = "订单ID:" + row.id + "-派单";
          selectPaidanPageVo({
            id: row.id,
          }).then((res) => {
            const paidanData = res.result || {};
            paidanData.orderId = row.id;
            this.paidanData = paidanData;
            this.paidanDialog = true;
          });
          break;
        case "shenhe":
          this.$confirm(`确认审核通过？`, "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          }).then(() => {
            jiazhuangdingdanshenhe({
              id: row.id,
            }).then((res) => {
              this.$message.success(res.msg || "操作成功");
              this.getData();
            });
          });
          break;
        case "selectShouyi":
          this.shouyiDialog = true;
          this.shouyiUserId = row.id;
          this.getShouyiData();
          break;
        default:
          return;
      }
    },
    handleSure(type) {
      console.log(type);
      type = type || this.handleType;
      //const { addrCode, ...rest } = this.updateForm;
      switch (type) {
        case "dongjie":
          this.$confirm(`确认冻结该账号？`, "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          }).then(() => {
            dongjieUser(
              {
                id:this.updateForm.userId,
              }
            ).then((res) => {
              this.$message.success(res.msg || "操作成功");
              this.getData();
            });
          });
          break;
        case "updateSetLevel":
          this.$confirm(`确认修改等级？`, "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          }).then(() => {
            updateUserLevel(
              {
                id:this.updateForm.userId,
                levelId:this.updateForm.levelId
              }
            ).then((res) => {
              this.$message.success(res.msg || "操作成功");
              this.getData();
            });
          });
          break;
        case "updateSetYqm":
          this.$confirm(`确认修改邀请码？`, "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          }).then(() => {
            userSetYaoqingma(
              {
                id:this.updateForm.userId,
                yaoqingma:this.updateForm.yaoqingma
              }
            ).then((res) => {
              this.$message.success(res.msg || "操作成功");
              this.getData();
            });
          });
          break;
        case "paidan":
          paidanOrder({
            orderId: this.paidanData.orderId,
            jiazhuangPlatformIdList: this.selectRow.map((d) => {
              return d.jiazhuangPlatformId;
            }),
          }).then((res) => {
            this.$message.success("派单成功");
            this.paidanDialog = false;
          });
          break;
        default:
          return;
      }
    },
    onSelectionChange(val) {
      this.selectRow = val;
    },
    handleCommand(command) {
      this.$message("click on item " + command);
    },
    uploadData(params) {
      const form = new FormData();
      form.append("file", params.file);
      const loading = this.$loading({
        lock: true,
        text: "正在导入...",
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)",
      });
      exportInData(form)
        .then((res) => {
          this.$message.success("导入成功");
          loading.close();
        })
        .catch(() => {
          loading.close();
        });
    },
    beforeUpload(file) {
      if (file.size > 1 * 1024 * 1024) {
        this.$message.warning("上传的文件大小不能超过1MB!");
        return false;
      }
    },
  },
};
</script>

<style scoped>
.power_right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 30px;
  margin-bottom: 10px;
}

.block {
  display: flex;
  height: 70px;
}
.block_item {
  padding: 5px 30px;
  box-sizing: border-box;
  border-right: 1px solid #ddd;
  color: #5f5f5f;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
}
.block_item:first-of-type {
  border-right: 0;
  align-self: flex-start;
}
.value {
  font-size: 24px;
  font-weight: bold;
}
.baijin-row {
  background: #fffbec;
}

.huangjing-row {
  background: #fff740;
}
.zuanshi-row {
  background: #95ffff;
}
</style>
